!
Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags. |
Moving the head
Description: Moving the head using the Pan-Tilt systemTutorial Level: BEGINNER
Next Tutorial: Moving the torso
Controlling the Pan and Tilt Joints
The Pan-Tilt system can be controlled using its position_controllers/JointTrajectoryController. You can send trajectory_msgs::JointTrajectory to the pan_tilt_trajectory_controller/command topic.
For this demonstration we will launch the Armadillo robot in Gazebo:
$ roslaunch robotican_armadillo armadillo.launch gazebo:=true
Now, Lets run the pan-tilt API example node by typing:
$ rosrun robotican_demos pan_tilt_api
This will generate and send a random goal to the pan_tilt_trajectory_controller/command topic.
You can also specify desired joints goals by adding them as arguments to the node (first argument is pan angle and the second is tilt angle):
$ rosrun robotican_demos pan_tilt_api 0.4 -0.9
Play with the angles and watch the pan-tilt system move in the Gazebo window.
Note: Positive values will make the system turn left and down.
The code is available at pan_tilt_api.cpp.
Controlling the head using the PointHead controller
For details on the controller please see the PR2 Moving the Head Tutorial.
The Implementation of the controller for RoboTiCan robots is a bit different and the updated code can be found on: point_head.cpp.
To run the demo after launching the robot run:
$ rosrun robotican_demos point_head